import { Injectable } from '@angular/core';
import { WindowService } from '@core/services/common/window.service';
import { MockData } from '@src/mock/userData';
import { APP_CONFIG } from '@env/environment';

@Injectable({
  providedIn: 'root',
})
export class AuthService {
  /*
    这里有2种权限
    Authenticating Login  认证登录使用权限
    Authorized Resources  授权资源访问权限
   */
  constructor(
    private windowServe: WindowService
  ) { }

  //获取认证登录权限
  getAuthorizationToken() {
    return this.windowServe.getSessionStorage('token');
  }

  //设置认证登录权限
  setAuthorizationToken(token: string) {
    return this.windowServe.setSessionStorage('token', token);
  }

  //获取授权资源访问列表
  getAuthorizedAccessResource() {
    return APP_CONFIG.isMock ? MockData.accessResourceList : [];
  }

}
